<?php

namespace app\admin\middleware;

use app\admin\model\OperationLogModel;

/**
 * 操作日志
 *
 * @Author tanruizheng
 * @DateTime 2021-07-29
 */
class OperationLog
{
    public function handle($request, \Closure $next)
    {
        return $next($request);
    }

    /**
     * 请求返回回调
     * @param  \think\Response  $response
     */
    public function end(\think\Response $response)
    {
        //记录后台操作日志
        if(request()->isPost()){
            return OperationLogModel::createOperationLog($response);
        }
        return false;
    }
}